package com.example.yls.demoa;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;

import java.io.File;

public class MainActivity extends AppCompatActivity {
    private Button btn_gettoken;
    //private Button btn_face_match;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        findViewById(R.id.btn_gettoken).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                final String filePath =
                        "./storage/emulated/legacy/Pictures/Screenshots/img"
                                + File.separator+"letf.jpg";
                File file = new File(filePath);
                Log.e("MainActivity", String.valueOf(file.exists()));
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        FaceDetect.detect(filePath);
                    }
                }).start();

            }
        });

//        findViewById(R.id.btn_face_match).setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                final String filePath1 =
//                        "/storage/emulated/legacy"
//                                + File.separator+"letf.jpg";
//                final String filePath2 =
//                        "/storage/emulated/legacy"
//                                + File.separator+"right.jpg";
//                new Thread(new Runnable() {
//                    @Override
//                    public void run() {
//                        FaceMatch.match(filePath1,filePath2);
//                    }
//                }).start();
//            }
//        });
    }
}
